package com.ag.zrt.action;

import javax.annotation.Resource;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.ag.bean.TbTaskStatus;
import com.ag.common.BaseAction;
import com.ag.zrt.service.TaskStatusService;
@Controller("updateTaskStatusAction")
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class UpdateTaskStatusAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2250861779886103024L;

	private String tsId;
	private String tsName;
	@Resource(name="TaskStatusService")
	private TaskStatusService taskStatusService;
	private TbTaskStatus taskStatus;
	private String msg;
	private String errorDetail;

	@Override
	public String execute() throws Exception {
		try {
		taskStatus = taskStatusService.findById(tsId);
		taskStatus.setTsName(tsName);
		taskStatusService.update(taskStatus);
		msg = "更新失败";
		errorDetail = "";
		return "update_ts_succ";
		}catch(Exception e){
			msg = "更新失败";
			errorDetail = e.toString();
			return "update_ts_failed";
		}

	}

	public void setTsId(String tsId) {
		this.tsId = tsId;
	}

	public String getMsg() {
		return msg;
	}

	public String getErrorDetail() {
		return errorDetail;
	}

	public void setTsName(String tsName) {
		this.tsName = tsName;
	}

	public void setTaskStatusService(TaskStatusService taskStatusService) {
		this.taskStatusService = taskStatusService;
	}

}
